import { ObjCreate } from "../ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { NormalTooltip } from "../tooltip/NormalTooltip";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { ImgBtn } from "../../copy/btn/ImgBtn";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
//class RuleExplainButton
    
    export  class RuleExplainButton /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._btn = ObjCreate.createImgBtn(ImagesConst.RuleExplain, 0, 0, 65, 22, this, "Button");
            this._btn.addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onMouseEventHandler);
            this._btn.addEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseEventHandler);
            this._tooltip = new NormalTooltip();
            this._tooltip.x = 66;
            this._tooltip.y = 0;
            this._toolTipData = new ToolTipInfo(NormalTooltip.ToolTipRenderType_ShortcutItem, null);
            return;
        }

        public get button(): ImgBtn
        {
            return this._btn;
        }

        public set tooltipText(arg1: string)
        {
            this._toolTipData.tooltipData = HTMLUtil.addColor(arg1, "#FFFFFF");
            this._tooltip.data = this._toolTipData;
            return;
        }

        /* internal  */onMouseEventHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.type;
            switch (loc1) 
            {
                case flash.events.MouseEvent.MOUSE_OVER:
                {
                    if (!this._tooltip.parent) 
                    {
                        this.addChild(this._tooltip);
                    }
                    break;
                }
                case flash.events.MouseEvent.MOUSE_OUT:
                {
                    if (this._tooltip.parent) 
                    {
                        this.removeChild(this._tooltip);
                    }
                    break;
                }
            }
            return;
        }

        /* internal */ /* var */_btn: ImgBtn;

        /* internal */ /* var */_tooltip: NormalTooltip;

        /* internal */ /* var */_toolTipData: ToolTipInfo;
    }
